<%@ page contentType="text/html;charset=UTF-8" %>
<%@ include file="/WEB-INF/views/include/taglib.jsp"%>
<html>
<head>
	<title>活动管理</title>
	<meta name="decorator" content="default"/>
	<script type="text/javascript">
		$(document).ready(function() {
			
		});
		function page(n,s){
			$("#pageNo").val(n);
			$("#pageSize").val(s);
			$("#searchForm").submit();
        	return false;
        }
		
	</script>
</head>
<body>
	<ul class="nav nav-tabs">
		<li class="active"><a href="${ctx}/market/event/">活动列表</a></li>
		<shiro:hasPermission name="market:event:edit"><li><a href="${ctx}/market/event/form">活动添加</a></li></shiro:hasPermission>
	</ul>
	<form:form id="searchForm" modelAttribute="event" action="${ctx}/market/event/" method="post" class="breadcrumb form-search">
		<input id="pageNo" name="pageNo" type="hidden" value="${page.pageNo}"/>
		<input id="pageSize" name="pageSize" type="hidden" value="${page.pageSize}"/>
		<ul class="ul-form">
			<li><label>活动名称：</label>
				<form:input path="name" htmlEscape="false" class="input-medium"/>
			</li>
			<li><label>活动标题：</label>
				<form:input path="title" htmlEscape="false" class="input-medium"/>
			</li>
			<li><label>开始日期：</label>
				<input name="eventStartDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${event.eventStartDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
			</li>
			<li><label>截止日期：</label>
				<input name="eventEndDate" type="text" readonly="readonly" maxlength="20" class="input-medium Wdate"
					value="<fmt:formatDate value="${event.eventEndDate}" pattern="yyyy-MM-dd HH:mm:ss"/>"
					onclick="WdatePicker({dateFmt:'yyyy-MM-dd HH:mm:ss',isShowClear:false});"/>
			</li>
			<li class="btns"><input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/></li>
			<li class="clearfix"></li>
		</ul>
	</form:form>
	<sys:message content="${message}"/>
	<table id="contentTable" class="table table-striped table-bordered table-condensed">
		<thead>
			<tr>
				<th>活动名称</th>
				<th>活动类型</th>
				<th>活动标题</th>
				<th>开始日期</th>
				<th>截止日期</th>
				<th>更新日期</th>
				<!-- <th>备注</th> -->
				<shiro:hasPermission name="market:event:edit"><th>操作</th></shiro:hasPermission>
			</tr>
		</thead>
		<tbody>
		<c:forEach items="${page.list}" var="event">
			<tr>
				<td><a href="${ctx}/market/event/form?id=${event.id}">
					${event.name}
				</a></td>
				<td>
				<script type="text/javascript">
					var type = '${event.type}';
					var result = "其他";
					if(type=="904")result="秒杀";
					else if(type=="905")result="团购";
					else if(type=="906")result="砍价";
					else if(type=="804")result="报名活动";
					else if(type=="805")result="投票活动";
					else if(type=="806")result="抽奖活动";

					document.write(result);
				</script>
				</td>
				<td>
					${event.title}
				</td>
				<td>
					<fmt:formatDate value="${event.eventStartDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					<fmt:formatDate value="${event.eventEndDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<td>
					<fmt:formatDate value="${event.updateDate}" pattern="yyyy-MM-dd HH:mm:ss"/>
				</td>
				<%-- <td>
					${event.remarks}
				</td> --%>
					
				<td>
					<a href="${ctx}/market/eventChannel/detail?eventId=${event.id}">渠道列表</a>
    				<a href="${ctx}/market/event/form?id=${event.id}">修改</a>
					<a href="${ctx}/market/event/delete?id=${event.id}" onclick="return confirmx('确认要删除该活动吗？', this.href)">删除</a>
				</td>
			</tr>
		</c:forEach>
		</tbody>
	</table>
	<div class="pagination">${page}</div>
</body>
</html>